package action;

import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class HelloW {
	public static void main(String[] args) throws Exception {
		//M1();
		//m2();
		PrintStream out = System.out;
	}

	private static void m2() throws IOException {
		String hString="helloworld";
		byte[] helloworld=hString.getBytes();
		new FileOutputStream(FileDescriptor.out).write(helloworld);
	}

	@SuppressWarnings({ "unused", "resource" })
	private static void M1() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
		Method standardStream = FileDescriptor.class.getDeclaredMethod("standardStream", int.class);
		standardStream.setAccessible(true);
		new PrintStream(new FileOutputStream((FileDescriptor)standardStream.invoke(null, 1))).println("hello world");
	}
}
